<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxml="urn:schemas-microsoft-com:xslt"
  xmlns:umbraco.library="urn:umbraco.library"
  exclude-result-prefixes="msxml umbraco.library">


  <xsl:output method="xml" omit-xml-declaration="yes" />

  <xsl:param name="currentPage"/>

  <!-- Input the documenttype you want here -->

  <xsl:variable name="level" select="1"/>
  <xsl:variable name="CurrentNodeLine" select="$currentPage/ancestor-or-self::*"/>

  <xsl:template match="/">


    <ul class="sf-menu">
      <li>
        <a href="/">
          <xsl:if test="$currentPage/@id = $currentPage/ancestor-or-self::* [@level=$level]/@id">
            <xsl:attribute name="class">current</xsl:attribute>
          </xsl:if>
          Home
        </a>
      </li>
      <xsl:for-each select="$currentPage/ancestor-or-self::* [@level=$level]/* [@isDoc and string(umbracoNaviHide) != '1']">
        <li>
          <a href="{umbraco.library:NiceUrl(@id)}">
            <!--
            <xsl:variable name="MenuID" select="@id"/>
            <xsl:for-each select="$CurrentNodeLine">
              <xsl:if test="current()/@id=$MenuID">
                <xsl:attribute name="class">current</xsl:attribute>
              </xsl:if>
            </xsl:for-each>
            -->
            <xsl:value-of select="@nodeName"/>
            <span>

            </span>
          </a>
          <xsl:variable name="level3" select="current()/* [@level=3 and @isDoc and string(umbracoNaviHide) != '1']"></xsl:variable>
          <xsl:if test="count($level3)>0">
            <ul>
              <xsl:for-each select="$level3">
                <li>
                  <a href="{umbraco.library:NiceUrl(@id)}">
                    <xsl:value-of select="@nodeName"/>
                    <span>

                    </span>
                  </a>
                  <xsl:variable name="level4" select="current()/* [@level=4 and @isDoc and string(umbracoNaviHide) != '1']"></xsl:variable>
                  <xsl:if test="count($level4)>0">
                    <ul>
                      <xsl:for-each select="$level4">
                        <li>
                          <a href="{umbraco.library:NiceUrl(@id)}">
                            <xsl:value-of select="@nodeName"/>
                            <span>

                            </span>
                          </a>
                          <xsl:variable name="level5" select="current()/* [@level=5 and @isDoc and string(umbracoNaviHide) != '1']"></xsl:variable>
                          <xsl:if test="count($level5)>0">
                            <ul>
                              <xsl:for-each select="$level5">
                                <li>
                                  <a href="{umbraco.library:NiceUrl(@id)}">
                                    <xsl:value-of select="@nodeName"/>
                                    <span>

                                    </span>
                                  </a>
                                </li>
                              </xsl:for-each>
                            </ul>
                          </xsl:if>
                        </li>
                      </xsl:for-each>
                    </ul>
                  </xsl:if>
                </li>
              </xsl:for-each>
            </ul>
          </xsl:if>
        </li>
      </xsl:for-each>
    </ul>
  </xsl:template>

</xsl:stylesheet>